import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HrEmployeeTrainingApplyVO, HrEmployeeTrainingApplyForm, HrEmployeeTrainingApplyQuery } from '@/api/general/humanresources/learning/types';

/**
 * 查询员工培训申请审批列表
 * @param query
 * @returns {*}
 */

export const listHrEmployeeTrainingApply = (query?: HrEmployeeTrainingApplyQuery): AxiosPromise<HrEmployeeTrainingApplyVO[]> => {
  return request({
    url: '/humanresource/hrEmployeeTrainingApply/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询员工培训申请审批详细
 * @param id
 */
export const getHrEmployeeTrainingApply = (id: string | number): AxiosPromise<HrEmployeeTrainingApplyVO> => {
  return request({
    url: '/humanresource/hrEmployeeTrainingApply/' + id,
    method: 'get'
  });
};

/**
 * 新增员工培训申请审批
 * @param data
 */
export const addHrEmployeeTrainingApply = (data: HrEmployeeTrainingApplyForm) => {
  return request({
    url: '/humanresource/hrEmployeeTrainingApply',
    method: 'post',
    data: data
  });
};

/**
 * 修改员工培训申请审批
 * @param data
 */
export const updateHrEmployeeTrainingApply = (data: HrEmployeeTrainingApplyForm) => {
  return request({
    url: '/humanresource/hrEmployeeTrainingApply',
    method: 'put',
    data: data
  });
};

/**
 * 删除员工培训申请审批
 * @param id
 */
export const delHrEmployeeTrainingApply = (id: string | number | Array<string | number>) => {
  return request({
    url: '/humanresource/hrEmployeeTrainingApply/' + id,
    method: 'delete'
  });
};
